﻿@model Menu
<div class="modal fade" aria-hidden="true" role="dialog" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <form class="form-horizontal uiform" action="@Url.Action("Save")" method="post"
                  data-modal="true" data-error-el=".alert-danger">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">@Html.EditStatus("系统菜单")</h4>
                </div>
                <div class="modal-body">
                    <div class="form-body">
                        @Html.AntiForgeryToken()
                        @Html.MarkCreate()
                        @Html.HiddenFor(p => p.Id)
                        @Html.HiddenFor(p => p.ParentId)
                        @Html.HiddenFor(p => p.SortPath)
                        @Html.HiddenFor(p => p.CreateUserId)
                        @Html.HiddenFor(p => p.CreateUserName)
                        @Html.HiddenFor(p => p.CreateDateTime)
                        <div class="alert alert-danger fxhide"></div>
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                上级：
                            </label>
                            <div class="col-md-8">
                                <p class="form-control-static">
                                    @ViewBag.ParentName
                                </p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-md-3">
                                <span class="required"> * </span>
                                编码：
                            </label>
                            <div class="col-md-8">
                                <input class="form-control" name="@nameof(Model.Code)" value="@Model.Code"
                                       data-validate="required: true,maxlength: 100"
                                       data-validate-message="required:'请输入编码'"
                                       type="text" autocomplete="off" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                <span class="required"> * </span>
                                名称：
                            </label>
                            <div class="col-md-8">
                                <input class="form-control" name="@nameof(Model.Name)" value="@Model.Name"
                                       data-validate="required: true,maxlength: 100"
                                       data-validate-message="required:'请输入名称'"
                                       type="text" autocomplete="off" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                样式：
                            </label>
                            <div class="col-md-8">
                                <input class="form-control" name="@nameof(Model.IconCls)" value="@Model.IconCls"
                                       type="text" autocomplete="off" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                地址：
                            </label>
                            <div class="col-md-8">
                                <textarea class="form-control" name="@nameof(Model.Url)" rows="3">@Model.Url</textarea>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                选项：
                            </label>
                            <div class="col-md-8">
                                <div class="input-group">
                                    <label class="checkbox-inline" style="padding-left: 0">
                                        <input class="uicheck"
                                               name="@nameof(Model.IsEnabled)"
                                               value="true" type="checkbox"
                                               @Html.IsChecked(Model.IsEnabled) />
                                        <span>启用</span>
                                    </label>
                                    <label class="checkbox-inline">
                                        <input class="uicheck"
                                               name="@nameof(Model.IsPublic)" value="true"
                                               type="checkbox" @Html.IsChecked(Model.IsPublic) />
                                        <span>公开</span>
                                    </label>
                                    <label class="checkbox-inline">
                                        <input class="uicheck"
                                               name="@nameof(Model.IsExpand)" value="true"
                                               type="checkbox" @Html.IsChecked(Model.IsExpand) />
                                        <span>展开</span>
                                    </label>
                                </div>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                备注：
                            </label>
                            <div class="col-md-8">
                                <textarea class="form-control" name="@nameof(Model.Note)" rows="3">@Model.Note</textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">
                        <i class="fa fa-save"></i> 保存
                    </button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        <i class="fa fa-sign-in"></i> 关闭
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    $('.uiform').on('submitsuccess', function (e, result) {
        if (result.success) {
            $('.modal').modal('hide');
            $('.treegrid').treegrid('reload');
        } else {
            fx.alert(result.message);
        }
    });
</script>